#pragma once
#include <src/miscellaneous/OS_basic.h>
#include <src/algorithm/1DSolver/dichotomy.h>
#include <src/data/Intervall.h>
#include <src/data/Polynomials.h>
#include <src/data/ParticleSet.h>
#include <src/miscellaneous/io/IOFacilities.h>



template <class T>
struct find_zero_example {

struct test_trap
{
  T operator()(const T & x) const
  {
    T breakpoint = (x-1.)*(x-2.)*(x-3.)*(x-4.);
	return breakpoint;
  }
};
struct test_trap1
{
  T operator()(const T & x) const
  {
    T breakpoint = 24. -50.*x + 35.*pow(x,2) -10.*pow(x,3) +pow(x,4);
	return breakpoint;
  }
};


struct test_func1d
{
  T operator()(const T & x) const
  {
    return sin(x)/(x*x+1.0);
  }
};

struct test_func1d_2
{
  T operator()(const T & x) const
  {
    using std::sqrt;
    T breakpoint = sqrt(x*x-1.0);
    return breakpoint;
  }
};
struct test_polynomial_algebra : public polynomial<T,particle<OS_double>>
{
	typedef typename polynomial<T,particle<OS_double>> polynomial_type;
	test_polynomial_algebra(const polynomial_type &from) : polynomial_type(from) {};
	test_polynomial_algebra(){
		polynomial_type x = polynomial_canonical_base<polynomial_type>()[1];
		(*this) = (x-1.)*(x-2.)*(x-3.)*(x-4.);
	};

	virtual T operator()(const T & x) const
	{
	  T breakpoint = polynomial_type::operator ()(x);
	   return breakpoint;
	};
};

};

void dichotomy_test();